<h1 class="ttt"><span>محتويات الصندوق</span></h1>
<div id="inner">
    <div class="inner2">
        <div class="checkbox">
            <input type="checkbox" checked="checked" id="box_check_all">
            <label for="box_check_all"><span></span>تحديد الكل</label>
        </div>
    </div>
    <form action="<?= base_url() ?><?= get_segment(1) ?>/forsend" method="post">
        <table class="tables">
            <thead>
                <tr class="head-row">
                    <th>#</th>
                    <th>الرقم</th>
                    <th><?php echo lang('label_created_date') ?></th>
                    <th><?= lang('label_title') ?></th>
                    <th><?= lang('label_weight') ?></th>
                    <th><?= lang('label_quantity') ?></th>
                    <th><?= lang('label_price') ?></th>
                </tr>
            </thead>
            <tbody>   
                <?
                foreach ($result as $val) {
                    $total_wigth[] = $val->weight;
                    if ($val->type == 'item_box') {
                        $items = get_items_under_box($val->id);
                    } else {
                        $items = array();
                    }
                    ?>
                    <tr class="row <?
                if (count($items) > 0) {
                    echo 'maximize';
                }
                    ?>">
                        <td class="checkbox">
                           <?
                   if($val->weight > 0){        
                           ?>
                            <input type="hidden" name="wiegth"  class="singel_wiegth" value="<?php echo $val->weight ?>" />
                            <input class="box_checkbox" style="padding: 5px;" checked="checked" type="checkbox" name="order_id[]" value="<?= $val->id ?>" id="cb<?= $val->id ?>" />
                            <label for="cb<?= $val->id ?>"><span></span></label>
                            <?
                }else{
                    echo '<b>#</b>';
                }
                            ?>
                        </td>

                        <td><a href="<?= base_url() ?>orders/view/<?php echo $val->id ?>"><?php echo $val->id ?></a></td>
                        <td><?php echo $val->create_date ?></td>
                        <td><? if (!empty($val->title)) { ?><a href="<?= $val->link ?>" target="_blank"><?php echo substr($val->title, 0, 50) ?>..</a> <?
                    } else {
                        echo $val->store;
                    }
                    ?></td>
                        <td><?= $val->weight ?> <?= lang('label_lbs') ?></td>
                        <td><?= $val->quantity ?></td>
                        <td><?= $val->price ?> <?= lang('label_rial') ?></td>
                    </tr>
                    <?
                    if (count($items) > 0) {
                        ?>
                        <tr>
                            <td class="detail" colspan="7">
                                <div class="detail_" >
                                    <table>
                                        <tbody>
                                            <tr class="row-detail-head">
                                                <th><?= lang('label_title') ?></th>
                                                <th><?= lang('label_quantity') ?></th>
                                                <th><?= lang('label_battery') ?></th>
                                                <th><?= lang('label_perfum') ?></th>
                                            </tr>
                                            <? foreach ($items as $value) { ?>           
                                                <tr class="row-detail">
                                                    <td style="width: 60%;"><a href="<?=$value->link?>" target="_blank"><?= $value->title ?></a></td>
                                                    <td><?= $value->quantity ?></td>
                                                    <td><?= lang('label_' . strtolower($value->battery)) ?></td>
                                                    <td><?= lang('label_' . strtolower($value->perfum)) ?></td>
                                                </tr> 
                                            <? } ?>
                                        </tbody>
                                    </table>  
                                </div>
                            </td>
                        </tr>
                        <?
                    }
                    ?>
                <? } ?>

            </tbody>
        </table>
       <div class="inner2">
        <div class="checkbox">
            <input type="checkbox" checked="checked" id="box_check_all2">
            <label for="box_check_all2"><span></span>تحديد الكل</label>
        </div>
    </div>
        <input type="hidden" name="total_wiegth_hidden" class="total_wiegth_hidden" value="<?= array_sum($total_wigth) ?>"/>
        <input type="hidden" name="total_wiegth_hidden_" class="total_wiegth_hidden_" value="<?= array_sum($total_wigth) ?>"/>
        <h3>مجموع الأوزان : <span><span class="label_total_wigth"><?= array_sum($total_wigth) ?></span> <?= lang('label_lbs') ?></span></h3>

        <div class="submit">
            <input type="submit"value="{Send item}" name="send" />
        </div>
    </form>

</div>

